extends Node2D
class_name Piece

var is_block: bool # 是否会阻止其他棋子占领这个格子
enum CAMP {PLAYER, ENEMY, OTHER, ALL} # 阵营的枚举类
var camp: CAMP # 阵营：玩家，敌方，无阵营
var can_move: bool # 是否可以推动

var max_hp:int
var left_hp:int

var my_coord = []

# 移动自己的position，更新自己记录的坐标位置
func move(coord_in):
	Chessboard.move_array(self, my_coord, coord_in)
	var tween = get_tree().create_tween()
	tween.tween_property($SelfSprite, "global_position", get_node("/root/Main_Controller/Grids").get_child(coord_in[0] * Chessboard.BOARD_SIZE + coord_in[1]).global_position,0.1)
	# $SelfSprite.global_position = get_node("/root/Main_Controller/Grids").get_child(coord_in[0] * Chessboard.BOARD_SIZE + coord_in[1]).global_position
	my_coord = [coord_in[0],coord_in[1]]

func receive_dmg(value_in):
	print("This is receive dmg func for piece, should not be used, receive dmg:",value_in)
